<template>
  <div class="page-container">
    <div class="home-header">
      <el-input
        v-model="searchContent"
        placeholder="请输入宠物名字"
        class="header-input"
        @keyup.enter.native="search"
      ></el-input>
      <el-button
        icon="el-icon-search"
        circle
        type="success"
        @click="search"
      ></el-button>
    </div>
    <div class="home-center">
      <el-carousel trigger="click" height="400px">
        <el-carousel-item v-for="item in yardLayoutList" :key="item">
          <img :src="item" alt="" />
        </el-carousel-item>
      </el-carousel>
    </div>
  </div>
</template>

<script>
export default {
  name: "home",
  data() {
    return {
      searchContent: "",
      yardLayoutList: [
        require("@/assets/img/yard-layout1.jpg"),
        require("@/assets/img/home-bg.jpg")
      ]
    }
  },
  methods: {
    testVuex() {
      console.log("vuex数据测试")
      const vuexData = this.$store.state.login.x_user_token
      if (vuexData === "11") {
        this.$message({
          message: "获取vuex中自己测试的数据成功",
          type: "success"
        })
      }
    },
    search() {
      this.$router.push({
        path: "/pet-manage",
        query: {
          searchContent: this.searchContent,
          openType: 0 //搜索模式：0，笼子管理进入：1
        }
      })
    }
  },
  components: {}
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="scss">
.page-container {
  margin-top: 40px;
  text-align: center;
  .home-header {
    display: flex;
    .header-input {
      margin-right: 10px;
    }
  }
  .home-center {
    margin-top: 50px;
    margin-bottom: 50px;
    img {
      width: 100%;
      max-width: 600px;
      height: 400px;
    }
  }
}
</style>
